/-app ...
/-app/appRoot
PageModel.ts
dragScroll.ts
/-app/koBindingHandlers
/-app/moreDialog ...
Model.ts
layout.html
style.css
main.css
start.ts
/-docs
/-docs/types
DocHost.ts
/-files
/-imports
/-persistence
/-typings
errors.js
functions.ts
index.html
try.js
xxxxxxxxxx
1
module teapo.app.moreDialog {
2
  
3
  export class Model {
4
​
5
    text = ko.observable<string>(null);
6
    matchItems = ko.observableArray<Model.MatchItem>([]);
7
​
8
    constructor(
9
      currentFile: string,
10
      currentSelection: string,
11
      private _files: string[],
12
      private _completed: (selected: string) => void) {
13
      
14
      this.text(currentSelection || (currentFile ? currentFile.slice(1) : ''));
15
      
16
      this.matchItems.push(<any>'one');
17
      this.matchItems.push(<any>'two');
18
      this.matchItems.push(<any>'three');
19
    }
20
​
21
    keydown(unused, e: KeyboardEvent) {
22
      if (e.keyCode === 13 || e.which === 13 || e.key === 'Enter') {
23
        this._keyEnter();
24
      }
25
      else if (e.keyCode === 27 || e.which === 27 || e.key === 'Escape') {
26
        this._keyEnter();
27
      }
28
      else if (e.keyCode === 38 || e.which === 38) {
29
        this._keyUp();
30
      }
31
      else if (e.keyCode === 40 || e.which === 40) {
32
        this._keyDown();
33
      }
34
      else {
35
        return true;
36
      }
37
    }
38
​
39
    acceptClick() {
40
      this._completed(this.text());
41
    }
42
​
43
    dismiss() {
44
      this._completed(null);
45
    }
46
  
47
    private _keyEnter() {
48
      this._completed(this.text()); // TODO: pass back the result
49
    }
50
  
51
    private _keyUp() {
52
      
53
    }
54
​
55
    private _keyDown() {
56
      
57
    }
58
    
59
  }
60
​
61
  export module Model {
62
    
63
    export class MatchItem {
64
      
65
    }
66
    
67
  }
68
  
69
}
13:79